package com.guomao.demoi;

import java.util.ArrayList;
import java.util.List;

public class JavaDemo {

    public static void main(String[] args) {

        List<String> names = List.of("张国清", "李强", "李世民", "雨姐", "李自成");

        names.stream().
                filter(s -> s.length() > 2).
                filter(s -> s.startsWith("李")).
                forEach(System.out::println);


/*        ArrayList<String> list1 = new ArrayList<>();

//
        for (String name : names) {
//            System.out.println(name);
            if (name.length() > 2) list1.add(name);
        }

        ArrayList<String> list2 = new ArrayList<>();
        for (String s : list1) {
//            System.out.println(s);
            if (s.startsWith("李")) list2.add(s);
        }

//        System.out.println(list2);

        for (String s : list2) {
            System.out.println(s);
        }*/

    }

}
